/**
 * Created by xml on 2019/1/5.
 */
import Header from '../../../components/Header.vue';
export default {
	name: "orderDetail",
	mounted: function() {
		this.data = this.$route.params.data;
		if (!this.data) {
			this.$router.push({
				name: 'home'
			})
		} else {
			this.showOrderDetail(this.data);
		}
	},
	components: {
		Header
	},
	methods: {

		//显示订单详情
		showOrderDetail(data) {
			this.showForm.productName = this.data.orderDetail.productName;
			this.showForm.orderId = this.data.orderId;
			this.showForm.outDate = this.$dateFormat(this.data.orderDetail.outDate, 'YYYY-MM-DD HH:mm:ss');
			this.showForm.createdDate = this.$dateFormat(this.data.orderDetail.createdDate * 1000, 'YYYY-MM-DD HH:mm:ss');
			this.showForm.realName = this.data.order.realName;
		},

		//返回主页
		backHome() {
			this.$router.push({
				name: 'home'
			})
		}
	},

	data() {
		return {
			showForm: {
				productName: '',
				orderId: '',
				outDate: '',
				createdDate: '',
				author: '',
				realName: ''
			},
			pageInfo: {
				currentPage: 1,
				pageSize: 4,
				totalNum: 0
			},
			data: {}

		}
	}

}
